﻿using System;
using fastCSharp;
using fastCSharp.code.cSharp;
using fastCSharp.net;

namespace diantou.web.ajax
{
    /// <summary>
    /// 收藏夹操作
    /// </summary>
    [fastCSharp.code.cSharp.ajax(IsPool = true)]
    class favorite : userHandle<favorite>
    {
        /// <summary>
        /// 删除收藏项目
        /// </summary>
        /// <param name="value"></param>
        /// <param name="onReturn"></param>
        public void Remove(diantou.dataAccess.favorites value, Action<returnValue<bool>> onReturn)
        {
            diantou.dataAccess.tcpCall.favorites.remove(value, currentUser.Id, onReturn);
        }
        /// <summary>
        /// 添加收藏项目
        /// </summary>
        /// <param name="value"></param>
        /// <param name="onReturn"></param>
        public void Append(diantou.dataAccess.favorites value, Action<returnValue<bool>> onReturn)
        {
            diantou.dataAccess.tcpCall.favorites.favorite(value, currentUser.Id, onReturn);
        }
        /// <summary>
        /// 创建收藏夹
        /// </summary>
        /// <param name="value"></param>
        /// <param name="onReturn"></param>
        public void Create(diantou.dataAccess.favorite value, Action<returnValue<int>> onReturn)
        {
            value.UserId = currentUser.Id;
            diantou.dataAccess.tcpCall.favorite.create(value, onReturn);
        }
        /// <summary>
        /// 修改收藏夹
        /// </summary>
        /// <param name="value"></param>
        /// <param name="onReturn"></param>
        /// <param name="onReturn"></param>
        public void Rework(diantou.dataAccess.favorite value, Action<returnValue<bool>> onReturn)
        {
            value.UserId = currentUser.Id;
            diantou.dataAccess.tcpCall.favorite.rework(value, onReturn);
        }
        /// <summary>
        /// 删除收藏夹
        /// </summary>
        /// <param name="id"></param>
        /// <param name="onReturn"></param>
        public void Delete(int id, Action<returnValue<bool>> onReturn)
        {
            diantou.dataAccess.tcpCall.favorite.delete(id, currentUser.Id, onReturn);
        }
    }
}
